﻿using System;
using System.Drawing;
using System.Windows.Forms;
using Moonlite.ExtensionApi.ControlInterfaces;
using Moonlite.Platform.General;

namespace Moonlite.Modules.Editors.DataTools
{
    public class DataCustomNode : AbstractCustomNode
    {
        public override bool CanDragDropToChildren
        {
            get { return false; }
        }

        internal void UpdateImage()
        {
            Image = Image.FromStream(typeof(DataCustomNode).Assembly.GetManifestResourceStream("Moonlite.Modules.Editors.DataTools.Resources.Icons.ProjectManager.XmlData.bmp"));
        }

        public DataCustomNode(IProjectManager projectManager)
            : base(projectManager)
        {
            ContextMenuStrip = new ContextMenuStrip();
            ToolStripItem openItem = new ToolStripMenuItem("Open", Image.FromStream(typeof(DataCustomNode).Assembly.GetManifestResourceStream("Moonlite.Modules.Editors.DataTools.Resources.Icons.OpenFileHS.png")));
            openItem.Click += (object sender, EventArgs e) =>
            {
                DataViewer dataViewer = new DataViewer();
                dataViewer.Open((string)Tag);
                Global.Instance.OpenDocument(Text, dataViewer);
            };

            ContextMenuStrip.Items.Add(openItem);
        }
    }
}
